package biblioteca.controlador;


import biblioteca.persistencia.Sancion;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Controller;
import biblioteca.servicio.SancionServicio;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;




@Controller
public class SancionControlador {
	

	private SancionServicio sancionservice;


    @Autowired
    @Required
    public void setSancionService(SancionServicio sancionservice) {
        this.sancionservice = sancionservice;
    }

    @RequestMapping(value = "/agregarSancion", method = RequestMethod.POST)
    public String doSancion(@RequestParam("dni") String dni){

                   final Sancion sancion = new Sancion();
		   sancionservice.create(sancion);
                   System.out.println("fecha sancion: "+sancion.getFechaF());


			      return "/altaSocio";
		}
    
    @RequestMapping(value = "/generarSancion", method = RequestMethod.POST)
    public String goGenerarSancion() {
			      return "/sancionarSocio";//es el JSP
		}


}


